﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;

namespace 硬盘录像
{
    public class DVR_SDK
    {
        [DllImport("DVR_NET_SDK.dll", EntryPoint = "NET_SDK_Init", CharSet = CharSet.Ansi, SetLastError = false)]
        public static extern System.Boolean NET_SDK_Init();

        [DllImport("DVR_NET_SDK.dll", EntryPoint = "NET_SDK_SetConnectTime", CharSet = CharSet.Ansi, SetLastError = false)]
        public static extern System.Boolean NET_SDK_SetConnectTime(System.UInt32 dwWaitTime, System.UInt32 dwTryTimes);

        [DllImport("DVR_NET_SDK.dll", EntryPoint = "NET_SDK_SetReconnect", CharSet = CharSet.Ansi, SetLastError = false)]
        public static extern System.Boolean NET_SDK_SetReconnect(System.UInt32 dwInterval, System.Boolean bEnableRecon);

        [DllImport("DVR_NET_SDK.dll", EntryPoint = "NET_SDK_DiscoverDevice", CharSet = CharSet.Ansi, SetLastError = false)]
        public static extern System.Int32 NET_SDK_DiscoverDevice(ref NET_SDK_DEVICE_DISCOVERY_INFO pDeviceInfo, int bufNum, int waitSeconds);
    }
    [StructLayout(LayoutKind.Sequential)]   
    public struct NET_SDK_DEVICE_DISCOVERY_INFO 
    {
        public System.UInt32 deviceType;
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]   
        public char[] productType;  

        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]   
        public char[] strIP; 

        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]   
        public char[] strNetMask; 

        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]   
        public char[] strGateWay; 

        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]   
        public byte[] byMac;

        public System.UInt16 netPort;
        public System.UInt16 httpPort;
        public System.UInt32 softVer;
        public System.UInt32 softBuildDate;
    }
}
